<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/12/3 0003
  Time: 23:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>

<body>
<script src="http://code.jquery.com/jquery-1.4.1.min.js"></script>
<form method="post" id="kaixin">
    账号:<input type="text" name="username" id="username"/>
    密码:<input type="password" name="password" id="password"/>
    <button id="submitId" type="button">登录</button>
</form>
<script>
    $(function () {
        $("#submitId").click(function () {
            var user=$("#username").val();
            var pwd=$("#password").val();
                //ajax提交表单
                $.ajax({
                    type:"POST",
                    url:"/login/check",
                    data:{"username":user,"password":pwd},
                    success:function (data) {
                        if(data=="login_succ"){
                            window.location.href="/user/home";
                        }else{
                            $("#login_error").css("visibility","visible");
                        }
                    }
                });
        });
    });
</script>

</body>
</html>
